﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Point = System.Drawing.Point;
using Size = System.Drawing.Size;

namespace Station.Common.Rejudgment
{
    /// <summary>
    /// 单元信息
    /// </summary>
    public class ErrCell
    {
        /// <summary>
        /// 单元ID，用于Mapping
        /// </summary>
        public int ID;
        /// <summary>
        /// 实际像素尺寸
        /// </summary>
        public Size ImgSize { get; set; } = new Size(0,0);
        /// <summary>
        /// 实际角度
        /// </summary>
        public double Angle { get; set; } = 0;
        /// <summary>
        /// cell在检测区域中位置
        /// </summary>
        
        public Rectangle rect;
        /// <summary>
        /// 最终结果
        /// </summary>
        public CellStatus Status { get; set; } = CellStatus.PASS;
        /// <summary>
        /// 报点列表
        /// </summary>
        public List<RectErr> RectErrs { get; set; } = new List<RectErr>();

        public ErrCell DeepCopy()
        {
            ErrCell newInstance = new ErrCell()
            {
                ID = this.ID,
                // = this.Pos,
                ImgSize = this.ImgSize,
                Angle = this.Angle,
                rect = this.rect,
                Status = this.Status
            };
            foreach(var item in RectErrs)
            {
                newInstance.RectErrs.Add(item.DeepCopy());
            }
            return newInstance;
        }
    }

    public enum CellStatus
    {
        PASS,
        OK,
        NG
    }
}
